package com.qf.controller;

import com.qf.entity.Hotal;
import com.qf.entity.ResultData;
import com.qf.entity.SearchParams;
import com.qf.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private ISearchService searchService;

    /**
     * 搜索酒店列表
     * @return
     */
    @RequestMapping("/searchlist")
    public ResultData<List<Hotal>> searchHotals(SearchParams searchParams) throws IOException {

        //执行查询业务
        List<Hotal> hotals = searchService.query(searchParams);

        return new ResultData<List<Hotal>>().setCode(ResultData.Code.CODE_SUCC).setData(hotals);
    }
}
